

#ifndef GUI_IMAGE_H__
#define GUI_IMAGE_H__

#include <stdint.h>

#include "gui_widget.h" 
#include "ui_widget_types.h"
#include "gui_asset_images.h"

#define GUI_IMAGE_ROTATE_MAX_WIDTH  (25) 
#define GUI_IMAGE_ROTATE_POINT_XCEN (47)
#define GUI_IMAGE_ROTATE_POINT_YCEN (47)

#define GUI_ROTATE_ANGLE_NORMALIZE  (360)


typedef struct{
    union{
    uint16_t    B: 5;
    uint16_t    G: 6;
    uint16_t    R: 5; 
    }RGB;
    uint16_t value; 
}gui_image_color_t; 

typedef struct{
    uint16_t * src;
    uint16_t * dest;
    
    uint16_t width;
    uint16_t newwidth;
    uint16_t maskcolor;
    
    int16_t angle;
    
    int16_t xcen;   // center of X 
    int16_t ycen;   // center of Y 
    
    int16_t startx;
    int16_t starty; 
}gui_image_rotate_t; 


void gui_rebuild_pointer_display_area(const ui_widgets_type_t * widget);

void gui_image_rotate(gui_image_rotate_t * image); 

//void gui_image_pointer_rotate( ui_widget_base_t * p_widget, int angle ); 

void gui_image_load_to_memory( const gui_assets_image_t * image, const ui_widgets_type_t * p_widget); 

void gui_image_show_bmp(const gui_assets_image_t * image, const ui_widgets_type_t * widget, widget_paint_opt_t *opt );// int16_t cs, int16_t ce, int16_t rs, int16_t re, uint16_t *p_dis_buff);

void gui_image_show_bmp_internal(const gui_assets_image_t * image, const ui_widgets_type_t * widget, widget_paint_opt_t *opt );

void gui_image_pointer_rotate(const ui_widgets_type_t * widget, widget_paint_opt_t *opt );//uint16_t rs, uint16_t re, uint16_t* p_dis_buff ); 


#endif 

